package dao.entity;

import java.sql.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Generated;
import org.hibernate.annotations.GenerationTime;

@Entity
public class Store {

	private long id;
	private String name;
	private String description;
	private Date createdDate;

	// private Set<StoreStatus> storeStatus = new HashSet<StoreStatus>();

	private Set<StoreType> type = new HashSet<StoreType>();

	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column
	@Generated(GenerationTime.INSERT)
	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	@OneToMany(fetch = FetchType.EAGER)
	@JoinColumn(name = "store_id")
	public Set<StoreType> getStoreType() {
		return type;
	}

	public void setStoreType(Set<StoreType> type) {
		this.type = type;
	}

	// @OneToMany(cascade = CascadeType.ALL)
	// @JoinTable(name = "store_storestatus", joinColumns = {@JoinColumn(name =
	// "storeId")},
	// inverseJoinColumns = {@JoinColumn(name = "storeStatusId")})
	// public Set<StoreStatus> getStoreStatus() {
	// return storeStatus;
	// }
	//
	// public void setStoreStatus(Set<StoreStatus> storeStatus) {
	// this.storeStatus = storeStatus;
	// }
}
